package com.linx.open.controller;

import com.linx.common.core.domain.R;
import com.linx.common.core.validate.AddGroup;
import com.linx.common.log.annotation.Log;
import com.linx.common.log.enums.BusinessType;
import com.linx.common.web.core.BaseController;
import com.linx.open.common.constant.OpenConstants;
import com.linx.open.domain.bo.YsyjLogBo;
import com.linx.open.service.IYsyjLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 设备信息
 *
 * @author 泽智科技
 * @date 2024-10-04
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/open/equipment-info")
public class EquipmentController extends BaseController {

    private final IYsyjLogService ysyjLogService;

    /**
     * 设备详情同步云上营家实时（测试）
     */
    @Log(title = "云上同步实时", businessType = BusinessType.OTHER)
    @PostMapping("/equipmentTbSs")
    public R<Void> qygjtsss(@Validated(AddGroup.class) @RequestBody String body) {
        YsyjLogBo bo = new YsyjLogBo();
        bo.setContentinfo(body);
        bo.setYsyjType(OpenConstants.ysyjType_SS);
        bo.setIsSuccess(OpenConstants.isSuccess_YES);
        ysyjLogService.insertByBo(bo);
        System.out.println("进来了"+ body);
        return toAjax(true);
    }

    /**
     * 设备详情同步云上营家（测试）
     */
    @Log(title = "云上非实时同步", businessType = BusinessType.OTHER)
    @PostMapping("/equipmentfssTb")
    public R<Void> qygjtsfss(@Validated(AddGroup.class) @RequestBody String body) {
        YsyjLogBo bo = new YsyjLogBo();
        bo.setContentinfo(body);
        bo.setYsyjType(OpenConstants.ysyjType_FSS);
        bo.setIsSuccess(OpenConstants.isSuccess_YES);
        ysyjLogService.insertByBo(bo);
        System.out.println("进来了"+ body);
        return toAjax(true);
    }

}
